package com.woniuxy.health.report.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.health.commons.entity.Report;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

/*
    用于报告单
 */
@Repository
@Mapper
public interface ReportMapper extends BaseMapper<Report> {

    //通过订单号和用户名查询报告单表id
    @Select("select * from t_report where order_no=#{order_no} and user_name=#{user_name}")
    @Results({
            @Result(id=true,column="id",property="id"),
            @Result(column="id",property="reportResults",many=@Many(select="com.woniuxy.health.report.mapper.ReportResultMapper.findReportResultByReportId"))
    })
    Report findIdByNoAndName(String order_no,String user_name);
}
